package net.gd.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class CustomizeSpringContext {

	private static ApplicationContext context;

	public static void InitContext() {
		getInstant();
	}
	
	public static Object getBean(Class<?> classType) {
		return getInstant().getBean(classType);
	}
	
	public static Object getBean(String beanName) {
		return getInstant().getBean(beanName);
	}
	
	private static ApplicationContext getInstant() {
		if (context == null) {
			context = new ClassPathXmlApplicationContext(new String[] {
					"classpath:applicationContext.xml"});
		}
		return context;
	}
}
